<!--
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * date: 2021-03-01 16:01:08
 * @LastEditors: Sam
 * @LastEditTime: 2021-12-09 10:46:45
-->
{include file="common/public/header"}
        <div class="layui-card">
            <div class="layui-card-body">
                <form class="layui-form padsome" action="" method="post" onsubmit="return false">                    
                        <div class="layui-form-item">
                              <label class="layui-form-label">标题</label>
                              <div class="layui-input-block">
                                <input type="text" name="title" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                              </div>
                            </div>
                            <div class="layui-form-item">
                              <label class="layui-form-label">图片描述</label>
                              <div class="layui-input-block">
                                 <input type="hidden" name="pic" id="pic" value='{$info.pic}' />
                              </div>
                            </div>
                              <div class="layui-form-item temp">
                                <label class="layui-form-label">选项</label>
                                <div class="layui-input-block">
                                  <table class="layui-table">
                                    <colgroup>
                                      <col  width="150">
                                      <col>
                                      <col>
                                    </colgroup>
                                    <thead>
                                      <div class="layui-btn add_option">添加</div>
                                      <tr>
                                        <th>选项编号</th>
                                        <th>选项标题</th>
                                        <th style="text-align:center">操作</th>
                                      </tr> 
                                    </thead>
                                    <tbody class="option_temp">
                 
                                      
                                    </tbody>
                                  </table>
                                </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" for="remark">答案：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="right_answer" class="layui-input">
                                 
                                </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" for="remark">解析：</label>
                                <div class="layui-input-block">
                                    <textarea class="layui-textarea" placeholder="" name="remark" >{$vo.remark ?? ''}</textarea>
                                </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block layui-layout-admin">
                                <div class="layui-footer" style="left: 0;">
                                    <button class="layui-btn" lay-submit lay-filter="submit">立即提交</button>
                                    <button class="layui-btn layui-btn-primary" type="button" onclick="close_frame()">返回</button>
                                </div>
                            </div>
                        </div>
                </form>
            </div>
        </div>
    </div>
</div>
 
{include file="common/public/footer" /}
{block name="script"}
<script>
    layui.extend({
        xmSelect: 'xm-select'
    }).use(['index', 'form', 'layarea', 'laydate', 'xmSelect'], function(){
        var $       = layui.$;
        var form    = layui.form;

        uploadInit('pic', 'image', '');
        form.render();
        // 监听表单提交
        form.on('submit(submit)', function(data){
            Post('', data.field, function(res) {
                if (res.code == 1) {
                    alert_success(res.msg, function() {
                        parent.layui.table.reload('table', {where: parent.where});
                        close_frame();
                    })
                } else {
                    alert_error(res.msg);
                }
            });
            return false;
        });

           $('.add_option').click(function(){
            $('.option_temp').append('<tr>'
                                +'<td><input type="text" name="option_number[]"  class="layui-input"></td>'
                                +'<td><input type="text" name="option_name[]" class="layui-input"></td>'
                                + '<td style="text-align:center;cursor: pointer;color: blue;" class="del">删除</td>'
                                + '</tr>'
                                
            );
        });
        $(document).on('click','.del',function(){
            $(this).parent().remove();
        })
});
</script>

{/block}

